/**
 * 
 */
package com.seedwill.common.util;

import java.sql.Timestamp;
import java.util.Collection;


/**
 * 参数校验帮助文件
 * @author kdyi
 */
public class ParaCheckHelper {

	public static boolean validParaN(long l){
		boolean flag = false;
		if(l>0){
			flag  = true;
		}
		return flag;
	}
	public static boolean validPara(Long l){
		return null != l;
	}
	
	public static boolean validParaN(double l){
		boolean flag = false;
		if(l>0){
			flag  = true;
		}
		return flag;
	}
	
	public static boolean validParaN(float l){
		boolean flag = false;
		if(l>0){
			flag  = true;
		}
		return flag;
	}	
	
	public static boolean validPara(Double l){
		return null != l;
	}
	public static boolean validPara(Byte l){
		return null != l;
	}
	public static boolean validPara(Short l){
		return null != l;
	}
	public static boolean validObjParaN(Long l){
		boolean flag = false;
		if(null != l && l.longValue()>0){
			flag  = true;
		}
		return flag;
	}
	public static boolean validObjPara(Long l){
		boolean flag = false;
		if(null != l && l.longValue()>=0){
			flag  = true;
		}
		return flag;
	}
	
	public static boolean validObjParaN(Double l){
		boolean flag = false;
		if(null != l && l.doubleValue()>0){
			flag  = true;
		}
		return flag;
	}

	
	public static boolean validPara(java.math.BigDecimal l){
		return null != l;
	}
	
	public static boolean validParaN(java.math.BigDecimal l){
		boolean flag = false;
		if(null != l && l.doubleValue()>0){
			flag  = true;
		}
		return flag;
	}
	
	public static boolean validParaN(int l){
		boolean flag = false;
		if(l>0){
			flag  = true;
		}
		return flag;
	}
	
	public static boolean validPara(Integer l){
		return null != l;
	}
	
	public static boolean validObjPara(Double l){
		boolean flag = false;
		if(null != l && l.doubleValue()>=0){
			flag  = true;
		}
		return flag;
	}
	
	public static boolean validObjParaN(Integer l){
		boolean flag = false;
		if(null != l && l.intValue()>0){
			flag  = true;
		}
		return flag;
	}
	
	public static boolean validObjPara(Integer l){
		boolean flag = false;
		if(null != l && l.intValue()>=0){
			flag  = true;
		}
		return flag;
	}
	
	/**
	 * 字符串非空检查
	 * @param str
	 * @return
	 */
	public static boolean validParaStr(String str){
		boolean flag = false;
		if(null != str && str.length()>0){
			flag  = true;
		}
		return flag;
	}
	/**
	 * @param str
	 * @return
	 */
	public static boolean notNull(Object str){
		return null != str;
	}
	/**
	 * @param str
	 * @return
	 */
	public static boolean isNull(Object str){
		return null == str;
	}
	
	public static boolean isEmptyStrTrimed(String str){
		boolean flag = false;
		if(null == str || 0 == str.trim().length()){
			flag  = true;
		}
		return flag;
	}
	/**
	 * 字符串非空检查(TRIM)
	 * @param str
	 * @return
	 */
	public static boolean validParaStrTrimed(String str){
		boolean flag = false;
		if(null != str && str.trim().length()>0){
			flag  = true;
		}
		return flag;
	}
	public static boolean validParaStrTrimedEq(String str, String comp){
		boolean flag = false;
		if(null != str && str.trim().length()>0 && str.trim().equals(comp)){
			flag  = true;
		}
		return flag;
	}
	/**
	 * 对象作为字符串非空检查
	 * @param obj
	 * @return
	 */
	public static boolean validParaAsSimpleString(Object obj){
		boolean flag = false;
		if(null != obj && obj.toString().length()>0){
			flag  = true;
		}
		return flag;
	}
	public static boolean validArrayNotEmpty(Object[] coll){
		return (null != coll && (coll.length>0));
	}
	/**
	 * 校验一个collection是否为空
	 * @param coll
	 * @return
	 */
	public static boolean validCollectionNotEmpty(Collection coll){
		return (null != coll && (!coll.isEmpty()));
	}
	/**
	 *  校验一个collection是否为NULL
	 * @param coll
	 * @return
	 */
	public static boolean validCollectionNotNull(Collection coll){
		return (null != coll);
	}

	public static boolean validPara(Timestamp obj) {
		// TODO Auto-generated method stub
		return null != obj;
	}
	public static boolean validPara(java.sql.Date obj) {
		// TODO Auto-generated method stub
		return null != obj;
	}
	public static boolean validPara(java.sql.Time obj) {
		// TODO Auto-generated method stub
		return null != obj;
	}
	public static boolean validPara(Float obj) {
		return null != obj;
	}
	public static boolean validPara(Object obj) {
		// TODO Auto-generated method stub
		return null != obj;
	}
}
